package com.sw.test01.ui.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.TextView;

import com.sw.test01.R;
import com.sw.test01.domain.bean.Person;
import com.sw.test01.ui.adapter.PersonVertivalAdapter;

import java.util.ArrayList;
import java.util.List;

public class ThirdActivity extends BaseActivity {
    private List<Person> mList = new ArrayList<>();
    private TextView tv01;
    private RecyclerView rv01;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_third);
        tv01 = (TextView) findViewById(R.id.tv01);
        rv01 = (RecyclerView) findViewById(R.id.rv01);
        initPerson();
        LinearLayoutManager layoutManager = new LinearLayoutManager(this);
        layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        rv01.setLayoutManager(layoutManager);
        PersonVertivalAdapter adapter = new PersonVertivalAdapter(mList);
        rv01.setAdapter(adapter);
    }
    private void initPerson() {
        for (int i=0; i<=100; i++){
            Person person = new Person();
            person.setImgId(R.mipmap.ic_launcher);
            person.setName("zs"+i);
            person.setAge(""+i);
            mList.add(person);
        }
    }
}
